Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
El mensaje Connect-flash no funciona para res.render("SomeView")

No puedo usar el paquete connect-flash para res.render. Mi objetivo principal es mostrar un mensaje flash en la representación de una vista.

Puedo hacer que funcione con un res.redirect ("ruta") pero no con el código res.render ("ver"). ¿Es por diseño?

Mi código se muestra a continuación

 if(err){ // Apparently res.render("register") didn't work with flash. But res.redirect("/register") worked. req.flash("error", err.message); // Error occurs when the user is taken, password is empty etc. return res.redirect("/register"); // Short circut everything. Else the code below this would run as well and that would throw an error }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esta es la sintaxis correcta para usar req.flash con res.render:

 req.flash('error', yourErrString); res.render("register.ejs", { message: req.flash('error') });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!